package cn.fldong.employee.servlet;

import cn.fldong.employee.dao.EmployeeDao;
import cn.fldong.employee.entity.EmployeeEntity;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/queryInfo")
public class QueryInfoServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        EmployeeDao dao = new EmployeeDao();
        String empID = req.getParameter("id");
        // 查询员工列表
        EmployeeEntity employee = dao.queryByEmpID(empID);
        req.setAttribute("employee", employee);
        req.getRequestDispatcher("queryinfo.jsp").forward(req, resp);
    }

}
